package backend

import "fmt"

type HomeController struct {
	baseController
}

func (self *HomeController) Index() {
	//menuList := library.MenuTree(self.Ctx.Request.RequestURI)
	//self.Data["Menu"] = menuList
	//fmt.Println(menuList)
	fmt.Println(11)
	self.chooseLayout()
}

func (self *baseController) chooseLayout() {
	if self.layout == "backend" {
		self.TplName = "backend/main.html"
	} else {
		self.display("welcome")
	}
}

func (self *HomeController) Welcome() {
	self.display()
}

//func (a *AdminController) AdminList() {
//	a.Data["listEmpty"] = false
//	var admin models.Admin
//	adminList, err := admin.GetAll()
//	if err != nil {
//		a.Data["listEmpty"] = true
//	}
//	a.Data["list"] = adminList
//	a.TplName = a.moduleName + "admin/admin_list.html"
//}
//
//func (a *AdminController) AdminAddView() {
//	var role models.Role
//	roleList, _ := role.GetAll()
//	a.Data["roleList"] = roleList
//	a.Layout = "admin/layer_layout.html"
//	a.LayoutSections = make(map[string]string)
//	a.LayoutSections["Scripts"] = a.moduleName + "admin/admin_add_script.html"
//	a.TplName = a.moduleName + "admin/admin_add.html"
//}
//
//func (a *AdminController) AdminAdd() {
//	var admin models.Admin
//	admin.Account = strings.TrimSpace(a.GetString("account"))
//	pwd := strings.TrimSpace(a.GetString("password"))
//	admin.Password = Md5(pwd)
//	id, err := admin.InsertData()
//	returnData := make(map[string]string)
//	if err != nil {
//		returnData["code"] = "999999"
//		returnData["msg"] = "添加失败"
//		beego.Error(err)
//	} else {
//		returnData["code"] = "000000"
//		returnData["msg"] = "添加成功, ID为 " + fmt.Sprint(id)
//	}
//	a.Data["json"] = &returnData
//	a.ServeJSON()
//	return
//}
